'use strict';

angular.module('sfhtHaitaoCmsApp')
	.controller('ResourceCtrl', function($scope, $injector, $modal, $log) {
		$scope.resouce = {};
		var PageService = $injector.get("PageService");
		$scope.init = function() {
			PageService.getResourceConfigs('H5_BASE_RESOURCE_VERSION')
				.then(function(data) {
					if(data && data.value && data.value.length > 0){
						$scope.version = data.value[0].value;
					}
				}, function(data) {});
		};

		$scope.updateVersion = function(key) {
			PageService.updateResourceConfigs(key, $scope.version)
				.then(function(data) {
					if(data.value){
						alert("保存成功");
					}
					else{
						alert("修改失败!");
					}
				}, function(data) {
					alert("修改失败!");
				});
		};
	});